﻿using System;
using System.Numerics;

class CalculateSum
{
    static void Main()
    {
        int numberN;
        int numberX;
        int numberPrecision;
        int multiplier = 1;
        decimal result;
        
        Console.WriteLine("Type a number N:");
        bool isFirstNumberValid = int.TryParse(Console.ReadLine(), out numberN);
        Console.WriteLine("Type a number X:");
        bool isSecondNumberValid = int.TryParse(Console.ReadLine(), out numberX);
        Console.WriteLine("Type a number of the decimal symbols (precision number):");
        bool isThirdNumberValid = int.TryParse(Console.ReadLine(), out numberPrecision);

        if (isFirstNumberValid && isSecondNumberValid && isThirdNumberValid)
        {
            for (int i = 0; i < numberPrecision; i++)
            {
                multiplier *= 10;
            }

            BigInteger sum = 1 * multiplier;

            BigInteger[] factorial = new BigInteger[numberN + 1];
            factorial[1] = 1;

            for (int i = 2; i <= numberN; i++)
            {
                factorial[i] = factorial[i - 1] * i;
            }

            BigInteger[] functionOfX = new BigInteger[numberN + 1];
            functionOfX[1] = numberX;

            for (int i = 2; i <= numberN; i++)
            {
                functionOfX[i] = functionOfX[i - 1] * numberX;
            }

            for (int i = 1; i <= numberN; i++)
            {
                sum = sum + factorial[i] * multiplier / functionOfX[i];
            }

            //Console.WriteLine(sum);
            result = (decimal)sum/multiplier;
            Console.WriteLine(result);
        }
       
        else
        {
            Console.WriteLine("Your input isn`t OK!!!");
        }
    }
}